//
//  SLDemo_RuntimeController.m
//  Objective-C
//
//  Created by S_Line on 2018/5/8.
//  Copyright © 2018年 S_Line. All rights reserved.
//

#import "SLDemo_RuntimeController.h"

#import "NSObject+Model.h"

#import "SLTeacher.h"

@interface SLDemo_RuntimeController ()

@property (nonatomic, strong) SLTeacher *t1;

@end

@implementation SLDemo_RuntimeController

- (void)initNavBar {
    self.navTitle = @"Runtime";
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initNavBar];
    
    [self initData];
    
    [self associatedProperty];
    
    [self initView];
}

- (void)associatedProperty {
    __weak typeof(self) weakSelf = self;
    self.view.tapBlock = ^{
        SLog(@"%@.viewTaped", [weakSelf class]);
    };
}

- (void)initData {
    NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
    
    [dict setObject:@55.8 forKey:@"weight"];
    [dict setObject:@165.8 forKey:@"height"];
    [dict setObject:@28 forKey:@"age"];
    [dict setObject:@"陆承东" forKey:@"name"];
    [dict setObject:@"陆承东" forKey:@"name1"];
    [dict setObject:@100091 forKey:@"tid"];
    NSMutableDictionary *bookDict = [NSMutableDictionary dictionary];
    [bookDict setObject:@"iOS开发基础" forKey:@"bookName"];
    [dict setObject:bookDict forKey:@"book"];
    
    SLTeacher *teacher = [SLTeacher modelWithDict:dict];
    self.t1 = teacher;
}

- (void)initView {
    UILabel *label1 = [[UILabel alloc] init];
    label1.text = [self.t1 description];
    label1.numberOfLines = 0;
    label1.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:label1];
    [label1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(10 + kNavigationBarHeight);
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
    }];
}

@end
